package global

import "fmt"

type keyParser = func(text string) (result interface{}, err error)

var KeyParsers = make(map[string]keyParser)

func register(key string, handler keyParser) {
	if _, exists := KeyParsers[key]; exists {
		info := fmt.Sprintf("key: %s is already exist", key)
		panic(info)
	}

	KeyParsers[key] = handler
}
